package com.ysu.his.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ysu.his.admin.mapper.ICDCatalogMapper;
import com.ysu.his.admin.service.ICDCatalogService;
import com.ysu.his.dto.ICDCatalogDto;
import com.ysu.his.entity.diagnosis.IcdCatalog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ICDCatalogServiceImpl implements ICDCatalogService
{
    @Autowired
    private ICDCatalogMapper icdCatalogMapper;

    @Override
    public PageInfo<IcdCatalog> getCatalogByPage(Integer page, Integer limit, ICDCatalogDto icdCatalogDto)
    {
        PageHelper.startPage(page,limit);

        List<IcdCatalog> icdCatalogList = icdCatalogMapper.getCatalogByPage(icdCatalogDto);

        PageInfo<IcdCatalog> pageInfo=new PageInfo<>(icdCatalogList);
        return pageInfo;
    }

    @Override
    public void addICDCatalog(IcdCatalog icdCatalog)
    {
        icdCatalogMapper.addICDCatalog(icdCatalog);
    }

    @Override
    public void updateICDCatalog(IcdCatalog icdCatalog)
    {
        icdCatalogMapper.updateICDCatalog(icdCatalog);
    }

    @Override
    public void startOrStop(Long id, Integer status)
    {
        icdCatalogMapper.startOrStop(id,status);
    }
}
